package crp.core.space.domain.repositories;

import com.qwlabs.lang.C2;
import crp.core.space.domain.models.SpaceEntity;
import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase;
import io.quarkus.panache.common.Parameters;

import javax.enterprise.context.ApplicationScoped;
import java.util.Collection;
import java.util.stream.Stream;

@ApplicationScoped
public class SpaceRepository implements PanacheRepositoryBase<SpaceEntity, String> {
    public Stream<SpaceEntity> findByIds(Collection<String> ids) {
        if (C2.isEmpty(ids)) {
            return Stream.empty();
        }
        return find("id in :ids", Parameters.with("ids", ids))
                .stream();
    }
}
